<?php
namespace app\common\model;
use think\Model;
use fast\Cols;
class Teacherstudent extends Model
{
	protected $pk = 'itemid';
	public function exists($teacherid = '0',$studentid = '0'){
		$where = array();
		$where['teacherid'] = $teacherid;
		$where['studentid'] = $studentid;
		$m = $this->get($where);
		if($m){
			return 1;
		}else{
			return 0;
		}
	}
	public function getStudentByTeacher($teacherid = '0'){
		$where = array();
		$where['teacherid'] = $teacherid;
		$list = $this->where($where)->select();
		$data = array();
		foreach ($list as $k => $v) {
			$data[] = $v['studentid'];
		}
		return $data;
	}
	public function getTeacherByStudent($studentid = '0'){
		$where = array();
		$where['studentid'] = $studentid;
		$list = $this->where($where)->select();
		$data = array();
		foreach ($list as $k => $v) {
			$data[] = $v['teacherid'];
		}
		return $data;
	}
	}
?>
